<?php


namespace IDock\Insurance\DEMO;

use IDock\Http\Response;
use IDock\IDock\IDockInterface;
use IDock\Insurance\DEMO\Request\ARenewalInquiryRequest;
use IDock\Insurance\DEMO\Request\BVehicleModelRequest;
use IDock\Insurance\DEMO\Request\CVehicleActualValueRequest;
use IDock\Insurance\DEMO\Request\DPremiumInquiryRequest;
use IDock\Insurance\DEMO\Request\EUnderwritingRequest;
use IDock\Insurance\DEMO\Request\FUploadFileRequest;
use IDock\Insurance\DEMO\Request\GPolicyPaymentRequest;
use IDock\Insurance\DEMO\Request\HEPolicyDownloadRequest;
use IDock\Insurance\DEMO\Request\INonCarProductListRequest;
use IDock\Insurance\DEMO\Request\J1ProposalStatusRequest;
use IDock\Insurance\DEMO\Request\J2ProposalRecallRequest;
use IDock\Insurance\DEMO\Request\K1PolicyStatusRequest;
use IDock\Insurance\DEMO\Request\K2PolicyRecallRequest;
use IDock\Insurance\DEMO\Request\ValidateCarRequest;
use IDock\Insurance\DEMO\Response\ARenewalInquiryResponse;
use IDock\Insurance\DEMO\Response\BVehicleModelResponse;
use IDock\Insurance\DEMO\Response\CVehicleActualValueResponse;
use IDock\Insurance\DEMO\Response\DPremiumInquiryResponse;
use IDock\Insurance\DEMO\Response\EUnderwritingResponse;
use IDock\Insurance\DEMO\Response\FUploadFileResponse;
use IDock\Insurance\DEMO\Response\GPolicyPaymentResponse;
use IDock\Insurance\DEMO\Response\HEPolicyDownloadResponse;
use IDock\Insurance\DEMO\Response\INonCarProductListResponse;
use IDock\Insurance\DEMO\Response\J1ProposalStatusResponse;
use IDock\Insurance\DEMO\Response\J2ProposalRecallResponse;
use IDock\Insurance\DEMO\Response\K1PolicyStatusResponse;
use IDock\Insurance\DEMO\Response\K2PolicyRecallResponse;
use IDock\Insurance\DEMO\Response\ValidateCarResponse;
use IDock\Visitor\EPolicyDownloadVisitor;
use IDock\Visitor\NonCar\NonCarInquiryVisitor;
use IDock\Visitor\NonCar\NonCarProductListVisitor;
use IDock\Visitor\PolicyInfoVisitor;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\ProposalRecallVisitor;
use IDock\Visitor\ProposalStatusVisitor;
use IDock\Visitor\RenewalInquiryVisitor;
use IDock\Visitor\UnderwritingRecallVisitor;
use IDock\Visitor\UploadFileVisitor;
use IDock\Visitor\ValidateCarVisitor;
use IDock\Visitor\VehicleActualValueVisitor;
use IDock\Visitor\VehicleModelVisitor;

class DEMOConstruct extends Builder implements IDockInterface
{
    public $config = [];

    public function __construct($config)
    {
        $this->config = $config;

        $this->usercode = $config['usercode'] ?? '';
        $this->password = $config['password'] ?? '';
    }

    /**
     * 续保查询
     * @param RenewalInquiryVisitor $renewalInquiryVisitor
     * @return ARenewalInquiryResponse
     */
    public function renewalInquiry(RenewalInquiryVisitor $renewalInquiryVisitor): ARenewalInquiryResponse
    {
        $request = new ARenewalInquiryRequest();
        $request->setVisitor($renewalInquiryVisitor);

        /*** @var ARenewalInquiryResponse $response */
        $response = $this->execute($request);
        return $response;

    }

    /**
     * 车型查询
     * @param VehicleModelVisitor $vehicleModelVisitor
     * @return BVehicleModelResponse
     */
    public function vehicleModel(VehicleModelVisitor $vehicleModelVisitor): BVehicleModelResponse
    {
        $request = new BVehicleModelRequest();
        $request->setVisitor($vehicleModelVisitor);

        /*** @var BVehicleModelResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 车辆实际价格
     * @param VehicleActualValueVisitor $vehicleActualValueVisitor
     * @return CVehicleActualValueResponse
     */
    public function vehicleActualValue(VehicleActualValueVisitor $vehicleActualValueVisitor): CVehicleActualValueResponse
    {
        $request = new CVehicleActualValueRequest();
        $request->setVisitor($vehicleActualValueVisitor);

        /*** @var CVehicleActualValueResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 询价前置
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return void
     */
    public function preInquiry(PremiumInquiryVisitor $premiumInquiryVisitor)
    {
    }

    public function validateCar(PremiumInquiryVisitor $premiumInquiryVisitor): Response
    {
        return new Response(200);
    }

    /**
     * 询价
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return DPremiumInquiryResponse
     */
    public function premiumInquiry(PremiumInquiryVisitor $premiumInquiryVisitor): DPremiumInquiryResponse
    {
        $request = new DPremiumInquiryRequest;
        $request->setVisitor($premiumInquiryVisitor);

        /*** @var DPremiumInquiryResponse $response */
        $response = $this->execute($request);

        return $response;
    }

    /**
     * 核保
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return EUnderwritingResponse
     */
    public function underwriting(PremiumInquiryVisitor $premiumInquiryVisitor): EUnderwritingResponse
    {

        $request = new EUnderwritingRequest();
        $request->setVisitor($premiumInquiryVisitor);

        /*** @var EUnderwritingResponse $response */
        $response = $this->execute($request);

        return $response;
    }

    /**
     * 文件上传
     * @param UploadFileVisitor $uploadFileVisitor
     * @return FUploadFileResponse
     */
    public function uploadFile(UploadFileVisitor $uploadFileVisitor): FUploadFileResponse
    {
        $request = new FUploadFileRequest();
        $request->setVisitor($uploadFileVisitor);

        /*** @var FUploadFileResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 支付
     * @param PolicyPaymentVisitor $paymentVisitor
     * @return GPolicyPaymentResponse
     */
    public function policyPayment(PolicyPaymentVisitor $paymentVisitor): GPolicyPaymentResponse
    {
        $request = new GPolicyPaymentRequest();

        $request->setVisitor($paymentVisitor);

        /*** @var GPolicyPaymentResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 电子保单下载
     * @param EPolicyDownloadVisitor $EPolicyVisitor
     * @return HEPolicyDownloadResponse
     */
    public function EPolicyDownload(EPolicyDownloadVisitor $EPolicyVisitor): HEPolicyDownloadResponse
    {
        $request = new HEPolicyDownloadRequest();
        $request->setVisitor($EPolicyVisitor);

        /*** @var HEPolicyDownloadResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 驾意险列表
     * @param NonCarProductListVisitor $nonCarProductListVisitor
     * @return INonCarProductListResponse
     */
    public function nonCarProductList(NonCarProductListVisitor $nonCarProductListVisitor): INonCarProductListResponse
    {

        $request = new INonCarProductListRequest();
        $request->setVisitor($nonCarProductListVisitor);

        /*** @var INonCarProductListResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 投保单状态查询
     * @param ProposalStatusVisitor $proposalStatusVisitor
     * @return J1ProposalStatusResponse
     */
    public function proposalStatus(ProposalStatusVisitor $proposalStatusVisitor): J1ProposalStatusResponse
    {
        $request = new J1ProposalStatusRequest();
        $request->setVisitor($proposalStatusVisitor);

        /*** @var J1ProposalStatusResponse $response */
        $response = $this->execute($request);

        return $response;
    }

    /**
     * 投保单撤单接口
     * @param ProposalRecallVisitor $revokeVisitor
     * @return J2ProposalRecallResponse
     */
    public function proposalRecall(ProposalRecallVisitor $revokeVisitor): J2ProposalRecallResponse
    {
        $request = new J2ProposalRecallRequest();
        $request->setVisitor($revokeVisitor);

        /*** @var J2ProposalRecallResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 保单状态
     * @param PolicyInfoVisitor $policyInfoVisitor
     * @return K1PolicyStatusResponse
     */
    public function policyInfo(PolicyInfoVisitor $policyInfoVisitor): K1PolicyStatusResponse
    {
        $request = new K1PolicyStatusRequest();
        $request->setVisitor($policyInfoVisitor);

        /*** @var K1PolicyStatusResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 人工核保撤回
     * @param UnderwritingRecallVisitor $recallVisitor
     * @return K2PolicyRecallResponse
     */
    public function underwritingRecall(UnderwritingRecallVisitor $recallVisitor): K2PolicyRecallResponse
    {
        $request = new K2PolicyRecallRequest();
        $request->setVisitor($recallVisitor);

        /*** @var K2PolicyRecallResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    public function nonCarInquiry(NonCarInquiryVisitor $nonCarInquiryVisitor): Response
    {
        return new Response(200);
    }

    public function nonCarUnderwriting(NonCarInquiryVisitor $inquiryPrinter): Response
    {
        return new Response(200);
    }

    /**
     * 验车码
     * @param ValidateCarVisitor $validateCarVisitor
     * @return ValidateCarResponse
     */
    public function validateCarCode(ValidateCarVisitor $validateCarVisitor): ValidateCarResponse
    {
        $request = new ValidateCarRequest();
        $request->setVisitor($validateCarVisitor);

        /*** @var $response ValidateCarResponse */
        $response = $this->execute($request);

        return $response;
    }

    /**
     * 新车备案
     * @return void
     */
    public function newVehicleRegistration(PremiumInquiryVisitor $premiumInquiryVisitor)
    {
    }
}
